home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / jockdem4.arc / IODEM2.PAS < prev    next >
Pascal/Delphi Source File  |  1991-04-28  |  5KB  |  154 lines

  1. {$R-}
  2. Program IOTTT5_Demo_2;
  3.  
  4. {IMPORTANT NOTE: Set Options Compile Conditional Defines to IOFull and
  5.                  select Compile Build.
  6. }
  7.  
  8. {$V-}   {turn of that damn string checking!!}
  9.  
  10. Uses CRT,FastTTT5,IOTTT5;
  11. Const
  12.       X1 = 5;      {main coordinates - make them constants so they can }
  13.       Y1 = 5;      {be easily modified if the screen doesn't look right}
  14.       X2 = 75;
  15.       Y2 = 17;
  16.  
  17. Type
  18.     Company_Record = Record
  19.                           Name : string[40];
  20.                           Title: string[40];
  21.                           Company: string[40];
  22.                           Addr1  : string[40];
  23.                           Addr2  : string[40];
  24.                           City   : string[40];
  25.                           State  : string[2];
  26.                           Zip    : string[9];
  27.                      end;
  28. var
  29.    BoxF : byte;    {box foreground color}
  30.    Misc : byte;    {Misc. text foreground color}
  31.    Back : byte;    {main background color}
  32.    MsgF : byte;    {message foreground color}
  33.    MsgB : byte;    {message background color}
  34.    HiF  : byte;    {highlighted field foreground color}
  35.    HiB  : byte;    {highlighted field background color}
  36.    LoF  : byte;    {normal field foreground color}
  37.    LoB  : byte;    {normal field background color}
  38.    Info : Company_Record;
  39.  
  40.  
  41.  Procedure Set_Colors;
  42.  {}
  43.  begin
  44.      If ColorScreen then
  45.      begin
  46.          BoxF := yellow;
  47.          Misc := LightCyan;
  48.          Back := blue;
  49.          MsgF := yellow;
  50.          MsgB := red;
  51.          HiF  := white;
  52.          HiB  := red;
  53.          LoF  := white;
  54.          LoB  := Cyan;
  55.      end
  56.      else
  57.      begin
  58.          BoxF := white;
  59.          Misc := Lightgray;
  60.          Back := black;
  61.          MsgF := black;
  62.          MsgB := lightgray;
  63.          HiF  := black;
  64.          HiB  := lightgray;
  65.          LoF  := white;
  66.          LoB  := black;
  67.      end;
  68.  end; {of proc Set_Colors}
  69.  
  70.  Procedure Paint_Screen;
  71.  {Clears the screen and writes all the peripheral text to the screen}
  72.  begin
  73.      Set_Colors;
  74.      ClrScr;                         {clear the screen}
  75.      FBox(X1,Y1,X2,Y2,BoxF,Back,2);    {draw a filled box}
  76.      FastTTT5.Fcol := Misc;          {set default write colors}
  77.      FastTTT5.Bcol := Back;
  78.      ColWrite(X1+5,Y1+2,'Name');
  79.      ColWrite(X1+5,Y1+3,'Title');
  80.      ColWrite(X1+5,Y1+4,'Company');
  81.      ColWrite(X1+5,Y1+5,'Address');
  82.      ColWrite(X1+5,Y1+7,'City');
  83.      ColWrite(X1+38,Y1+7,'State');
  84.      ColWrite(X1+50,Y1+7,'Zip');
  85.      ColWrite(X1+12,Y1+11,'Enter data and press F10 to complete input');
  86.  end; {of proc Paint_Screen}
  87.  
  88.   Procedure Write_Info;
  89.   {}
  90.   var CH : char;
  91.   begin
  92.       Clrscr;
  93.       If I_Char = #027 then
  94.          Writeln('You Escaped!!');
  95.       Writeln('Your input was:');
  96.       Writeln(Info.Name);
  97.       Writeln(Info.Title);
  98.       Writeln(Info.Company);
  99.       Writeln(Info.Addr1);
  100.       Writeln(Info.Addr2);
  101.       Writeln(Info.City);
  102.       Writeln(Info.State);
  103.       Writeln(Info.Zip);
  104.       WriteLN;
  105.       Writeln('press any key');
  106.       Ch := readkey;
  107.   end; {of proc Write_Info}
  108.  
  109.  
  110.  
  111. begin    {Main program}
  112.     Paint_Screen;
  113.     Fillchar(Info,sizeOf(Info),#0);            {clear the variable Info}
  114.     Create_Tables(1);                          {we will only be having 1 simultaneous update}
  115.     Create_Fields(8);                          {create 8 input fields}
  116.     Define_Colors(HiF,Hib,LoF,LoB,MsgF,MsgB);  {tell IO what colors to use}
  117.     Allow_Esc(True);                           {let the user Escape}
  118.  
  119.     Add_Field(1,   8,2,8,2,  X1+18, Y1+2);     {add field info for field 1}
  120.     String_Field(1, Info.Name, '***********************************'); {assign variable to field and define format}
  121.  
  122.     Add_Field(2,   1,3,1,3,  X1+18, Y1+3);   {add field info for field 2}
  123.     String_Field(2, Info.Title, '***********************************');
  124.  
  125.     Add_Field(3,   2,4,8,4,  X1+18, Y1+4);   {add field info for field 3}
  126.     String_Field(3, Info.Company, '***********************************');
  127.  
  128.     Add_Field(4,   3,5,3,5,  X1+18, Y1+5);   {add field info for field 4}
  129.     String_Field(4, Info.Addr1, '***********************************');
  130.  
  131.     Add_Field(5,   4,6,4,6,  X1+18, Y1+6);   {add field info for field 5}
  132.     String_Field(5, Info.Addr2, '***********************************');
  133.  
  134.     Add_Field(6,   5,7,5,7,  X1+18, Y1+7);   {add field info for field 6}
  135.     String_Field(6, Info.City, '********************');
  136.  
  137.     Add_Field(7,   6,8,6,8,  X1+45, Y1+7);   {add field info for field 7}
  138.     String_Field(7, Info.State, '!!');       {Force Upper case}
  139.  
  140.     Add_Field(8,   7,1,7,1,  X1+55, Y1+7);   {add field info for field 8}
  141.     String_Field(8, Info.Zip, '#####-####'); {Force numbers with a "-"}
  142.  
  143.     Process_Input(1);   {allow the user to input data}
  144.  
  145.     Write_Info;         {call write_info procedure above}
  146.  
  147.     Dispose_Fields;
  148.     Dispose_Tables;
  149.     Clrscr;
  150.     WriteAT(1,1,white,black,'Run DemoTTT.exe for the main demo program');
  151.     WriteAT(1,2,white,black,'Technojock''s Turbo Toolkit v5.0');
  152.     GotoXY(1,5);
  153. end.
  154.